home *** CD-ROM | disk | FTP | other *** search
- 10 rem (NULL)oan (NULL)lanner by peekaldwin (NULL). (NULL)routman
- 20 rem (NULL)ranslated for the lenommodore 64 by str$onna (NULL). (NULL)oody
- 30 :
- 40 poke53272,23:rem selects upper/lower case
- 50 printchr$(8):rem disables c/shift key
- 60 poke53280,11:rem sets border color to gray 1
- 70 poke53281,11:rem set background color to gray 1
- 80 printchr$(158):rem set character color to yellow
- 90 :
- 100 rem set up title page
- 110 :
- 120 print chr$(147):rem clear/home screen
- 130 print tab(13)"[204][207][193][206][160][208][204][193][206][206][197][210]":print""
- 140 print tab(18)"by":print""
- 150 print tab(10)"[194]aldwin [204]. [212]routman"
- 160 printtab(6)"[212]ranslated by [196]onna [203]. [215]oody"
- 170 printtab(7) " [208]ress any key to continue";
- 180 printtab(35):poke204,0:poke207,0:geta$:poke204,1
- 190 ifa$=""then180
- 200 :
- 210 rem instructions and choice screen
- 220 :
- 230 printchr$(147):print"[198]ive main variables recur in finance"
- 240 print"problems. [212]hese are:"
- 250 print:printtab(5)"[193]nnual interest rate":printtab(5)"[208]resent value of loan"
- 260 printtab(5)"[198]uture value of loan":printtab(5)"[205]onthly payment"
- 270 printtab(5)"[206]umber of payments"
- 280 print:print"[212]his program will permit you to calcu-"
- 290 print"late one of the following, given the others."
- 300 print:print"[215]hich do you want to calculate?"
- 310 printtab(5)"1. [205]onthly [208]ayment"
- 320 printtab(5)"2. [193]mount you can [194]orrow":printtab(5)"3. [206]umber of [208]ayments"
- 330 printtab(5)"4. [194]alance after [206] [208]ayments":printtab(5)"5. [193]ccumulated [201]nterest"
- 340 printtab(9)"(payments [202] thru [203])"
- 350 print:print"[197]nter <1 - 5>: ";
- 360 poke204,0:poke207,0: geta$:ifa$=""then360
- 370 a=val(a$):poke204,1
- 380 ifa<1ora>5thenprint:goto440
- 390 printchr$(147)
- 400 print:print:print"[197]nter the annual interest rate in per-"
- 410 poke19,32: input"cent: ";r$:r=val(r$):print
- 420 ifr<=0thenzz=3:zy=0:gosub1460:goto400
- 430 i=(r/12)/100:onagoto480,530,640,700,770
- 440 zz=20:zy=18:gosub1460:goto350
- 450 :
- 460 rem monthly payment information
- 470 :
- 480 gosub920:gosub 950:gosub860:ific=0goto1500
- 490 mp=pv*(i/(1-ic)):gosub870:j=1:k=np:ijk=mp*np-pv:goto1090
- 500 :
- 510 rem amount to borrow information
- 520 :
- 530 print:print"[197]nter the amount you want to pay per"
- 540 input"month: ";mp$:mp=val(mp$):print
- 550 ifmp<=0thenzz=6:zy=4:gosub1460:goto530
- 560 print:print"[197]nter the number of payments you want"
- 570 input"to make: ";np$:np=val(np$):print
- 580 ifnp<=0thenzz=9:zy=7:gosub1460:goto560
- 590 np=int(np)
- 600 gosub860:ific=0then1500
- 605 pv=mp*(1-ic)/i:gosub870:j=1:k=np:ijk=mp*np-pv:goto1090
- 610 :
- 620 rem number of payments information
- 630 :
- 640 gosub920:gosub980
- 645 t=i*pv/mp:ift>1then1500
- 650 np=-(log(1-t))/log(1+i):gosub860:ific=0then1500
- 655 gosub870
- 660 j=1:k=int(np):ijk=mp*np-pv:goto1090
- 670 :
- 680 rem balance information
- 690 :
- 700 gosub920:gosub980
- 710 print:print"[194]alance after how many payments?"
- 720 inputnp$:np=val(np$):print:ifnp<=0thenzz=12:zy=10:gosub1460:goto710
- 730 gosub860:ific=0then1500
- 735 gosub870:j=1:k=np:goto810
- 740 :
- 750 rem accumulated interest information
- 760 :
- 770 gosub920:gosub980:gosub1010
- 780 :
- 790 rem calculations
- 800 :
- 810 np=j-1:gosub860:ific=0then1500
- 812 gosub870:bj=rb:np=k:gosub860:ific=0then1500
- 815 gosub870:bk=rb
- 820 gosub880:goto1090
- 830 :
- 840 rem calculations
- 850 :
- 860 ic=(1+i)^-np:return
- 870 rb=(1/ic)*(mp*((ic-1)/i)+pv):return
- 880 ijk=bk-bj+(k-j+1)*mp:return
- 890 :
- 900 rem input lines
- 910 :
- 920 print:print "[197]nter initial amount of your loan:":inputpv$:pv=val(pv$):print
- 930 ifpv<=0thenzz= 6:zy= 4:gosub1460:goto920
- 940 return
- 950 print:print"[197]nter number of monthly payments:":inputnp$:np=val(np$):print
- 960 ifnp<=0thenzz= 9:zy=7:gosub1460:goto950
- 970 np=int(np):return
- 980 print:print"[197]nter your monthly payment: ":inputmp$:mp=val(mp$):print
- 990 ifmp<=0thenzz=9:zy=7:gosub1460:goto980
- 1000 return
- 1010 print:print"[197]nter payment number where calculations":input"are to begin: ";j$
- 1020 j=val(j$):print:ifj<=0thenzz=12:zy=10:gosub1460:goto1010
- 1030 print:print"[197]nter payment number where calculations":input"are to end: ";k$
- 1040 k=val(k$):print:ifk<=0thenzz=15:zy=13:gosub1460:goto1030
- 1050 return
- 1060 :
- 1070 rem print out information
- 1080 :
- 1090 printchr$(147):print"[217]our loan calculations are:":print
- 1100 print"[193]nnual interest:";:x=r:gosub1320:print" "x2$"%"
- 1110 print"[193]mount of loan:";:x=pv:gosub1320:print"$"x2$
- 1120 print"[205]onthly payment:";:x=mp:gosub1320:print"$"x2$
- 1130 print"[206]umber of payments:";:x=np:gosub1320:print"[160]"x2$
- 1140 print"[212]otal amount paid:";:x=mp*np:gosub1320:print"$"x2$
- 1150 print"[201]nterest paid:";:x=ijk:gosub1320:print"$"x2$
- 1160 print"(payments ";j;" thru ";k;")"
- 1170 print"[210]emaining balance:";:x=rb:gosub1320:print"$"x2$
- 1180 print"(after ";k;" payments)"
- 1190 :
- 1200 rem another or end
- 1210 :
- 1220 print:print"[196]o another calculation (y/n)?[160]";
- 1230 poke204,0:poke207,0:getn$:poke204,1:ifn$=""then1230
- 1250 ifn$="y"thenprintchr$(147):goto300
- 1260 ifn$="n"then1290
- 1270 ifn$<>"n"orn$<>"y"thenprint:zz=15:zy=14: gosub1460:goto1220
- 1280 :
- 1290 print"[147]load"chr$(34)"payload"chr$(34)",8":print"run"
- 1295 poke631,13:poke632,13:poke198,2:end
- 1300 :
- 1310 rem formats numbers for print out
- 1320 x=int((x+.001)*100):xx$=str$(x):x%=len(xx$)
- 1330 xo$=right$(xx$,2):rem xo$ is decimal part of the number
- 1340 x1$="":rem x1$ is integer part of the number
- 1350 ifx=0thenx1$="0":xo$="00":goto1400
- 1360 ifx%=1thenx1$="0"+xo$:goto1400
- 1370 ifx%=2thenifleft$(xx$,1)="-"thenxo$="0"+right$(xo$,1):x1$="-0":goto1400
- 1380 ifx%=2then1400
- 1390 x1$=left$(xx$,(x%-2))
- 1400 x2$=x1$+"."+xo$:ht=len(x1$)
- 1410 rem x2$ is formatted number.
- 1420 printtab(29-ht):return
- 1430 :
- 1440 rem error trapping response
- 1450 :
- 1460 forxz=1to20-zz:print"";:next
- 1470 print"[211]orry. [217]ou made an incorrect entry. [208]lease re-enter."
- 1480 forxz=1to23-zy:print"[145]";:next
- 1490 return
- 1492 :
- 1495 rem error message if ic=0 to prevent division by zero
- 1499 :
- 1500 printchr$(147)
- 1501 poke53280,1:poke53281,2:printchr$(5)
- 1510 print"[212]here has been an error."
- 1520 print:print"[207]ne of the enteries you made resulted"
- 1525 print"in a mathematical error."
- 1530 print:print"[208]lease re-check your numbers."
- 1540 printtab(7)" [208]ress any key to continue";
- 1550 print tab(35):poke204,0:poke207,0:geta$
- 1560 ifa$=""then1550
- 1570 poke204,1
- 1580 poke53280,11:poke53281,11:printchr$(158):printchr$(147):goto300
-